#include <ESP8266WiFi.h>
#include "user_interface.h"
#include "storage.h"

const char *ssid = "iKuai2G-cc7b";
const char *password = "314314314";

String config_path = "/config.txt";

void readWIFI_config() {
  readFS(config_path);
}

void connect_WIFI()
{
  WiFi.mode(WIFI_STA);
  WiFi.setSleepMode(WIFI_NONE_SLEEP);
  delay(300);

  Serial.begin(115200);

  Serial.println();
  Serial.println();
  Serial.println();

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print("wait\n");
  }

  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
  writeFS(config_path, String(ssid) + String(password));
}
